<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>

<!DOCTYPE >
<html>
<!-- 数据报告中的课程数据界面 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/top.css" />
<link rel="stylesheet" href="../../css/home.css" />
<script src="../../js/jquery.min.js"></script>
<script src="../../js/top.js"></script>
<script src="../../js/echarts.min.js"></script>
<script src="../../js/the-charts.js"></script>
<title>智行校园-精准化服务平台</title>
</head>
<body class="background">
  <input type="hidden" value="数据报告"  />
	<div class="container">
		<ul class="charts_left">
			<li class="selected"><a href="class_data_analyse.jsp">学分数据</a></li>
			<li><a href="score_data_analyse.jsp">成绩数据</a></li>
			<li><a href="sign_data_analyse.jsp">点名数据</a></li>
			<li><a href="library_data_analyse.jsp">借阅数据</a></li>
			<li ><a href="cost_data_analyse.jsp">一卡通消费数据</a></li>
		</ul>
		<div class="charts_right">
			<h3>学分数据</h3>
			<div class="cost_pie"></div>
			<div class="cost_line"></div>
			<div class="charts_describe"></div>
		</div>
	</div>
	<form method="post"  name="userid_form" >
	    <input type="hidden" value="" name="userid" />
    </form>
	<script>
	var user_name = '<%=session.getAttribute("username")%>';
	var user_id = '<%=session.getAttribute("userid")%>';
	   $('body').append(' <input id="user_id" style="display:none" value="'+user_id+'"  />');
	   $('form[name="userid_form"] input:hidden').attr('value',user_id);
	   $('ul.charts_left li a').click(function(){
		   $('form[name="userid_form"]').attr('action',$(this).attr('href'));
		   $('form[name="userid_form"]').submit();
			return false;
	   });
	   $.getJSON('/College/report/getCredits',{userid:user_id},function(data){
					var c1 = echarts.init($('.cost_line')[0], 'macarons');
					var c2 = echarts.init($('.cost_pie')[0], 'macarons');
					c1.hideLoading();
					c2.hideLoading();
					var option1 = Config(data.term+'学期完成课程情况',false,'bar').option5(data.line_data);
					var option2 = Config(data.term+'学期完成学分情况','','').option4(data.pie_data);
					c1.setOption(option1, true);
					c2.setOption(option2, true);
					var str='';
					if(data.describe[1]=='0')
					   $('div.charts_describe').append(
							'<span>总体而言，在过去的<font>' + data.describe[0] + '</font>，已完成学分<font>'+
							data.describe[1]+'</font>，未完成学分<font>'+data.describe[2]+'</font>，学分完成<font>'+data.describe[3]+
							'</font>相信您一定很努力。</span>');
					else
					   $('div.charts_describe').append(
							   '<span>总体而言，在过去的<font>' + data.describe[0] + '</font>，已完成学分<font>'+
								data.describe[1]+'</font>，未完成学分<font>'+data.describe[2]+'</font>，学分完成<font>'+data.describe[3]+
								'</font>请注意学分积累。</span>');
					$(window).resize(function() {
						c1.resize();
						c2.resize();
						c1.setOption(option1);
						c2.setOption(option2);
					});
				});
	</script>
</body>
</html>